﻿using SKeeper.Domain.Companies;
using SKeeper.Domain.Repositories;
using SKeeper.Domain.Users;
using SKeeper.Persistence.Facade;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SKeeper.Persistence.Repositories
{
    public class CompanyRepository : GenericRepository<Company>, ICompanyRepository
    {
        public CompanyRepository(DomainModelFacade context)
            :base(context)
        {           
        }

        public void CreateCompanyForUser(User user, string name)
        {
            var company = new Company
            {
                UserId = user.Id,
                Name = name
            };

            this.db.Companies.Add(company);
            this.db.SaveChanges();


        }
    }
}
